package com.societyGames.flashForms
{
	import com.societyGames.system.EventObject;
	
	import flash.display.DisplayObject;
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.MouseEvent;

	public class TabItem extends EventDispatcher
	{
		private var _tabHeader:DisplayObject;
		private var _content:DisplayObject;
		private var _headerClickedEventObject:EventObject;
		
		public function TabItem(tabHeader:DisplayObject, content:DisplayObject)
		{
			this._headerClickedEventObject = new EventObject(this, "CLICKED");
			this._tabHeader = tabHeader;
			this._content = content;
			
			this._tabHeader.addEventListener(MouseEvent.CLICK, tabHeaderClickedHandler);
		}
		
		public function get tabHeader():DisplayObject
		{
			return this._tabHeader;
		}
		
		public function get content():DisplayObject
		{
			return this._content;
		}	
		
		public function get headerClickedEventObject():EventObject
		{
			return this._headerClickedEventObject;
		}
		
		private function tabHeaderClickedHandler(event:MouseEvent):void
		{
			this._headerClickedEventObject.dispatchEvent();
		}
	}
}